package dao;

import java.sql.PreparedStatement;
import java.sql.ResultSet;

import javax.swing.JOptionPane;

import model.userModel;
import util.dataUtil;

public class comboId {
	public static int getIdCombo(String table,String namecombo)
	{
		int id=0;
		
		String sql ="select * from"+" "+table+" "+"where name = '"+namecombo+"'";
		JOptionPane.showMessageDialog(null, sql);
		try {
			PreparedStatement ps = dataUtil.getconnConnection().prepareStatement(sql);
			ResultSet rs = ps.executeQuery();
			while(rs.next()) {
				id=rs.getInt("ID");
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return id;
	}
}
